
(() => {
    console.log('启动成功');

    /* 
类类型: 实现接口
1. 一个类可以实现多个接口
2. 一个接口可以继承多个接口
*/

    interface Alarm {
        alert(): any;
    }

    interface Light {
        lightOn(): void;
        lightOff(): void;
    }

    class Car implements Alarm {
        alert() {
            console.log('Car alert');
        }
    }

    class Car2 implements Alarm, Light {
        alert() {
            console.log('Car alert');
        }
        lightOn() {
            console.log('Car light on');
        }
        lightOff() {
            console.log('Car light off');
        }
    }

    //接口的继承
    interface LightableAlarm extends Alarm, Light {

    }

    class car3 implements LightableAlarm{
        alert() {
            console.log('Car LightableAlarm off');
        }
        lightOn(): void {
            console.log('Car LightableAlarm off');
        }
        lightOff(): void {
            console.log('Car LightableAlarm off');
        }
        
    }

    let t =  new car3();
    t.lightOff();
    t.lightOn();
    t.alert();

})()